package com.xxl.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 数据传输对象
 * @author xxl
 * @date 2023/3/14
 */
@Data
@NoArgsConstructor
@Validated
@Schema(name = "User",title = "User:用于实体类对象")
public class User {
    @Schema(name = "id",title = "用户id，主键")
    private int id;
    @Schema(name = "name",title = "用户姓名")
    @NotEmpty(message = "不可以为空字符")
    @NotNull(message = "不可以为空")
    @Size(min = 1,max = 3,message = "最大不能超过3个字符")
    private String name;
    @Schema(name = "pwd",title = "用户密码")

    private String pwd;
    /**
     *  用户权限
     */
    private String status;
    /**
     *
     */
    private String identity;

    public User(String name, String pwd, String status) {
        this.name = name;
        this.pwd = pwd;
        this.status = status;
    }

    public User(String name, String pwd, String status, String identity) {
        this.name = name;
        this.pwd = pwd;
        this.status = status;
        this.identity = identity;
    }

    public User(int id, String name, String pwd, String status) {
        this.id = id;
        this.name = name;
        this.pwd = pwd;
        this.status = status;
    }
}
